<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:p="http://primefaces.org/ui"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core">
    <h:head>
        <title>Facelet Title</title>
	
    </h:head>
    <h:body>

	Hello from Facelets
	<p:growl/>
	<h:form id="janela">

	    <p:dialog 
		id="Ndialog" 
		header="Car Detail" 
		widgetVar="carDialog" 
		resizable="false"  
		width="500" showEffect="clip" hideEffect="fold">  
		<h:panelGrid columns="2" id="display">
		    Nome
		    <p:inputText value="#{clienteBean.cliente.nome}"/>
		    Telefone
		    <p:inputText value="#{clienteBean.cliente.telefone}"/>
		    E-mail
		    <p:inputText value="#{clienteBean.cliente.email}"/>
		</h:panelGrid>
		<p:commandButton value="Gravar" />
	    </p:dialog>
	</h:form>

	<h:form>




	    <p:dataTable 
		value="#{clienteBean.clientes}" 

		var="cliente">



		<p:column>
		    <f:facet name="header">Id</f:facet>
		    #{cliente.id}
		</p:column>
		<p:column>
		    <f:facet name="header">Nome</f:facet>
		    #{cliente.nome}
		</p:column>
		<p:column>
		    <f:facet name="header">Telefone</f:facet>
		    #{cliente.telefone}
		</p:column>
		<p:column>
		    <f:facet name="header">E-mail</f:facet>
		    #{cliente.email}
		</p:column>

		<p:column>
		    <f:facet name="header">Opções</f:facet>
		    <p:commandButton value="Editar" 
				     action="#{clienteBean.editar()}"
				     icon="ui-icon-search"  
				     update=":janela:Ndialog"
				     oncomplete="carDialog.show()"/>  

		</p:column>
	    </p:dataTable>




	</h:form>
    </h:body>
</html>

